From c64b144866fb7f970655b7bf0f5d9eced562ce7c Mon Sep 17 00:00:00 2001 From: Arne Heizmann Date: Thu, 8 Jul 2004 16:50:22 +0000 Subject: [PATCH] Special:Allpages now has a "next page" and a "back to index" link --- includes/SpecialAllpages.php | 63 ++++++++++++++++++++---------------- languages/Language.php | 1 + 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index ccac741ebd..d848880a65 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -31,40 +31,38 @@ function indexShowToplevel() return; } - -# $fromwhere = "FROM cur WHERE cur_namespace=0 AND cur_is_redirect=0"; $fromwhere = "FROM cur WHERE cur_namespace=0"; $order = "ORDER BY cur_title"; $out = ""; - + $sql = "SELECT COUNT(*) AS count $fromwhere"; $res = wfQuery( $sql, DB_READ, $fname ); $s = wfFetchObject( $res ); $count = $s->count; $sections = ceil( $count / $indexMaxperpage ); - + $sql = "SELECT cur_title $fromwhere $order LIMIT 1"; $res = wfQuery( $sql, DB_READ, $fname ); $s = wfFetchObject( $res ); $inpoint = $s->cur_title; - + $out .= "\n"; # There's got to be a cleaner way to do this! for( $i = 1; $i < $sections; $i++ ) { $from = $i * $indexMaxperpage; $sql = "SELECT cur_title $fromwhere $order ".wfLimitResult(2,$from); $res = wfQuery( $sql, DB_READ, $fname ); - + $s = wfFetchObject( $res ); $outpoint = $s->cur_title; $out .= indexShowline( $inpoint, $outpoint ); - + $s = wfFetchObject( $res ); $inpoint = $s->cur_title; - + wfFreeResult( $res ); } - + $from = $i * $indexMaxperpage; $sql = "SELECT cur_title $fromwhere $order ".wfLimitResult(1,$count-1); $res = wfQuery( $sql, DB_READ, $fname ); @@ -75,7 +73,7 @@ function indexShowToplevel() # Saving cache $log->replaceContent( $out ); - + $wgOut->addHtml( $out ); } @@ -98,43 +96,52 @@ function indexShowline( $inpoint, $outpoint ) function indexShowChunk( $from ) { - global $wgOut, $wgUser, $indexMaxperpage; + global $wgOut, $wgUser, $indexMaxperpage, $wgLang; $sk = $wgUser->getSkin(); - + $maxPlusOne = $indexMaxperpage + 1; + $out = ""; - $sql = "SELECT cur_title -FROM cur -WHERE cur_namespace=0 AND cur_title >= '" . wfStrencode( $from ) . "' -ORDER BY cur_title -LIMIT {$indexMaxperpage}"; + $sql = "SELECT cur_title FROM cur WHERE cur_namespace=0 AND cur_title >= '" + . wfStrencode( $from ) . "' ORDER BY cur_title LIMIT " . $maxPlusOne; $res = wfQuery( $sql, DB_READ, "indexShowChunk" ); -# FIXME: Dynamic column widths, backlink to main list, -# side links to next and previous + ### FIXME: side link to previous + $n = 0; - $out = "
\n"; - while( $s = wfFetchObject( $res ) ) { + $out = "
\n"; + while( ($n < $indexMaxperpage) && ($s = wfFetchObject( $res )) ) { $t = Title::makeTitle( 0, $s->cur_title ); if( $t ) { $link = $sk->makeKnownLinkObj( $t ); } else { $link = "[[" . htmlspecialchars( $s->cur_title ) . "]]"; } - if( $n == 0 ) { + if( $n % 3 == 0 ) { $out .= "\n"; } - $out .= ""; - $n = ++$n % 3; - if( $n == 0 ) { + $out .= ""; + $n++; + if( $n % 3 == 0 ) { $out .= "\n"; } } - if( $n != 0 ) { + if( ($n % 3) != 0 ) { $out .= "\n"; } $out .= "
$link$link
"; -#return $out; - $wgOut->addHtml( $out ); + + $out2 = "
" . + $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ), + wfMsg ( 'allpages' ) ); + if ( ($n == $indexMaxperpage) && ($s = wfFetchObject( $res )) ) { + $out2 .= " | " . $sk->makeKnownLink( + $wgLang->specialPage( "Allpages" ), + wfMsg ( 'nextpage', $s->cur_title ), + "from=" . wfStrencode( $s->cur_title ) ); + } + $out2 .= "
"; + + $wgOut->addHtml( $out2 . $out ); } ?> diff --git a/languages/Language.php b/languages/Language.php index b4ac58bd08..46b22f9479 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -892,6 +892,7 @@ That comes to '''$5''' average edits per page, and '''$6''' views per edit.", 'wantedpages' => 'Wanted pages', 'nlinks' => '$1 links', 'allpages' => 'All pages', +'nextpage' => 'Next page ($1)', 'randompage' => 'Random page', 'shortpages' => 'Short pages', 'longpages' => 'Long pages', -- 2.20.1